home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-01-20 | 3.8 KB | 82 lines | [TEXT/MPS ] |
- /* MJS:
-
- This is a second upload of SonOfGrep for MPW. The first one was lost
- when MAUG was reorganized in November 89. Slight changes from the
- previous version include a spinning cursor.
-
- Welcome to Son of Grep. As far as I can tell, this is a public
- domain version of UNIX Grep. I found it on GEnie. It was uploaded by
- John Pence, whose GEnie mail ID is MACMAN. He failed to reply to my notes
- requesting his explicit permission to re-use the source files, but
- there's nothing in the files to indicate he reserved any rights to them.
-
- It appears that the source of the source (so to speak) was an article
- in Dr. Dobbs Journal, but no copyright notice appears in the code, so
- I'm assuming John wrote most of it from scratch.
-
- It also appears that John's version was originally compiled using
- Consulair Mac C. One of the source files I omitted contained glue to
- simulate a command-line interface for the program, and without that glue,
- the rest of the code looked to me like it would compile just fine in a
- UNIX-like environment. As a matter of fact, it did. I made minimal
- adjustments to make it compatible with MPW C, and each of those adjustments
- is clearly indicated by a comment with my initials.
-
- I've used this little Grep tool extensively, but I haven't tried all of
- its options yet. As such, it's relatively untested. Use at your own
- risk, I guess, although I'm pretty confident it all works.
-
- I recommend you make Grep an alias for SonOfGrep. Here's a tiny script
- useful for grep'ing all files in a folder:
- SonOfGrep {Parameters} `files -t TEXT`
-
- Send comments to me, Matthew Snyder, CIS 71450,2606.
-
- Here is the file description associated with the original upload on GEnie...
-
- * This is the example from Alan Holubs October 1984 Grep article. Newcomers
- * to grepping will find the article most helpful, as this application has
- * very little in the way of interface. Greps one file at a time, uses syntax
- * as described in the article. Converted to run in Consulair Mac C. Source
- * in Grep.c and tools.c Enjoy- John Pence
-
- Here is usage information, gleamed from other sources (fgrep) but probably
- pretty accurate...
-
- * USAGE: fgrep [-?vclnhyef] [strings] <files>
- *
- * where:
- *
- * -v All lines but those matching are printed.
- * -c Only a count of the matching lines is printed.
- * -l The names of the files with matching lines are listed
- * (once), separated by newlines.
- * -n Each line is preceded by its line number in the file.
- * -h Do not print filename headers with output lines.
- * -y All characters in the file are mapped to upper case
- * before matching. (This is the default if the string
- * is given in the command line under CP/M, as CP/M
- * maps everything on the command line to upper case.
- * Use the -f option if you need both lower and upper
- * case). Not a true UNIX "fgrep" option (normally
- * available under "grep" only), but too useful to leave out.
- * -e <string>. Same as a string argument, but useful
- * when the string begins with a '-'.
- * -f <file>. The strings (separated by newlines) are taken
- * from a file. If several strings are listed in the
- * file, then a match is flagged if any of the strings
- * are matched. If -f is given, any following argument
- * on the command line is taken to be a filename.
-
- A note on usage: Unlike most MPW tools, this one requires that the
- options be passed in order. In addition, only one hyphen is needed.
- For example, if you want line numbers and you want all lines EXCEPT
- those containing matches to be printed, you would type
- SonOfGrep -nv string filename(s)
- "SonOfGrep -vn" would not work, and neither would "SonOfGrep -n -v."
-
- *****************************************************************************/
-
- /* MJS: OSreset normally called before abort, apparently leftover from CP/M */
- OSreset() { printf("# %s almost done... ", ToolName()); };
-